<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      :inline="true"
      v-show="showSearch"
      label-width="68px"
    >
      <el-form-item label="任务令" prop="taskNo">
        <el-input
          v-model="queryParams.taskNo"
          placeholder="请输入任务令"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
        <el-form-item label="产品条码" prop="sn">
        <el-input
          v-model="queryParams.sn"
          placeholder="请输入产品条码"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button
          type="cyan"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
    </el-row>
    <el-table v-loading="loading" :data="entityRevisionList">
      <!-- <el-table-column type="selection" align="center" /> -->
      <el-table-column
        label="创建人工号"
        align="center"
        prop="createdBy"
        :show-overflow-tooltip="true"
        width="100"
      />
      <el-table-column
        label="创建人名称"
        align="center"
        prop="createdByName"
        :show-overflow-tooltip="true"
        width="150"
      />
      <el-table-column
        label="创建时间"
        align="center"
        prop="creationDate"
        width="100"
      />
      <el-table-column
        label="关系id"
        align="center"
        prop="customLinkId"
        width="100"
      />
      <el-table-column
        label="关联类型"
        align="center"
        prop="linkType"
        :show-overflow-tooltip="true"
        width="100"
      />
      <el-table-column
        label="客户定制栏位名称"
        align="center"
        prop="linkedCustomKeyname"
        :show-overflow-tooltip="true"
        width="100"
      />
      <el-table-column
        label="客户定制栏位值"
        align="center"
        prop="linkedCustomValue"
        width="120"
      />
     
      <el-table-column
        label="回传结果"
        align="center"
        prop="res"
        :show-overflow-tooltip="true"
        width="100"
      />
      
      <el-table-column
        label="工厂ID"
        align="center"
        prop="siteId"
      />
      <el-table-column
        label="产品条码"
        align="center"
        prop="sn"
        :show-overflow-tooltip="true"
        width="100"
      />
      <el-table-column
        label="条码类别"
        align="center"
        prop="snType"
        :show-overflow-tooltip="true"
        width="150"
      />
      <el-table-column
        label="任务令"
        align="center"
        prop="taskNo"
        :show-overflow-tooltip="true"
        width="100"
      />
      
    </el-table>

    <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
            @pagination="getList" />
  </div>
</template>

<script>
import { getList } from "@/api/ems/barcodeReturn";

export default {
  
  data() {
    return {
      // 遮罩层
      loading: false,

      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,

      entityRevisionList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        taskNo: null,
        sn: null,
         pageNum: 1,
                    pageSize: 10,
      },
      // 表单参数
      form: {},
    };
  },
created(){
this.getList()
},
  methods: {
    /** 查询产品条码属性列表 */
    getList() {
      
      this.loading = true;
      getList(this.queryParams)
        .then((response) => {
          this.entityRevisionList = response.rows;
          this.total = response.total;
          this.loading = false;
        })
        .catch(() => {
          this.loading = false;
        });
    },
    updatedFormatter(val) {
      if (val.existUpdated == "Y") {
        return "是";
      } else {
        return "否";
      }
    },
    revisionFormatter(val) {
      if (val.specialRevision == "1") {
        return "是";
      } else {
        return "否";
      }
    },
    modeFormatter(val) {
      switch (val.modeProcduction) {
        case "0":
          return "烧录软件";
        case "1":
          return "加载软件";
        default:
          return "";
      }
    },
    // 表单重置
    reset() {
      this.form = {
        po: "",
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
    },
  },
};
</script>